#ifndef OPTIONS_H_
#define OPTIONS_H_

//std headers
#include <string>
#include <vector>

//boost headers
#include <boost/lexical_cast.hpp>

//project headers
#include "./Simpleini/SimpleIni.h"


//! Options
/*!
	Trieda options sluzi na nacitavanie konfiguracnych
	parametrov pre modul popripade aplikaciu
*/
class Options
{
	public:
		
		//! Options (Konstruktor)
		/*!
			Nacitavanie parametrov sa uskutocnuje z suboru config.ini
		*/
		Options(std::string myPath)
		{
			myConfigReader.SetMultiKey();
			std::string config = myPath + "config.ini";
			myConfigReader.LoadFile(config.c_str());
		}
		
		//! Options (Konstruktor)
		/*!
			Nacitavanie parametrov sa uskutocnuje z uzivatelom zadaneho
			suboru
			\param std::string theConfigFile configuracny subor
		*/
		Options(std::string myPath,std::string &theConfigFile)
		{
			myConfigReader.SetMultiKey();
			myConfigReader.LoadFile(theConfigFile.c_str());
		}
		
		//! GetOne (public )
		/*!
			Navrati jednu hodnotu parametra z config filu 
			\param const char * section
			\param const char * param
			\return 
		*/
		template<typename T> T GetOne(const char *section,const char *param)
		{
				T result =  boost::lexical_cast<T>(myConfigReader.GetValue(section,param));
				return result;
		}

		//! GetAll (public )
		/*!
			Navrati kolekciu hodnot prisluchajucich k rovnakemu parametru
			\param const char * selection
			\param const char * param
			\return 
		*/
		template<typename T> std::vector<T> GetAll(const char*selection,const char *param)
		{
			std::vector<T> result;
			CSimpleIniA::TNamesDepend values;
			CSimpleIniA::TNamesDepend::const_iterator iter;
			myConfigReader.GetAllValues(selection,param,values);

			for( iter = values.begin(); iter != values.end(); ++iter)
			{
				result.push_back(boost::lexical_cast<T>(iter->pItem));
			}

			return result;
		}

	private:
		CSimpleIniA myConfigReader;
};

#endif
